import React from 'react';
import toFixed from 'shared/utils/toFixed';
import showPresentList from 'shared/components/PresentList';
import './index.less';

class ProductOrderList extends React.Component {

  render() {
    const { item } = this.props
    const { discountFee, presentlist = [] } = item;
    return (
      <div className="product-order-list">
        <div className="product-order-list-item">
          <div className="imgbox">
            <img src={item.image} alt="" />
          </div>
          <div className="item-info">
            <div className="item-info-name">
              <span>佳能</span>
              <span >{item.title && `${item.title.substring(0, 20)}...`}</span>
              <div className="item-info-brief">{item.brief && `${item.brief.substring(0, 20)}...`}</div>
              {
                !!presentlist.length &&
                <div className="item-info-presentlist">
                  <div>【赠品】{presentlist[0].title}</div>
                  {
                    presentlist.length > 1 ?
                      <div onClick={()=> showPresentList(presentlist)}>显示全部</div>
                      :
                      <div>x1</div>
                  }
                </div>
              }
            </div>
            <div className="item-info-ctrl">
              <span className="item-price">
                <span>￥{toFixed(item.price)}</span>
                {
                  discountFee && <span>优惠: ￥{toFixed(discountFee)}</span>
                }
              </span>
              <div className="item-info-number">
                {/* <span className="item-focus">{toFixed(item.weight)}kg</span> */}
                <span className="item-join">x{item.quantity}</span>
              </div>
            </div>
          </div>
        </div>
      </div>
    );
  }
}

export default ProductOrderList;
